package com.wb.utils

import com.google.gson.Gson
import java.nio.charset.Charset

/**
 * 舔狗日记工具
 *
 * @author 祁雪
 */
class DogLogUtil {

    companion object {
        fun getInFileByRes(
            name: String,
            charset: Charset
        ): String {

            // 从 源文件 中挑选一份
            val jsonStr = ResourceUtil.readFileByRes(name, charset)

            val strs = Gson().fromJson(jsonStr, ArrayList::class.java)

            // 随机选择一条
            val msg = strs.get((Math.random() * strs.size).toInt()).toString();
            // println(msg)
            return msg;
        }
    }

}